﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using ModelXML;

namespace Etapa1.Import
{
    public static class ImporterHelper
    {
        public static Vector3 toVector3(Ponto3D point)
        {
            return new Vector3(point.x, point.y, point.z);
        }

        public static Vector4 PosToVector4(Ponto3D point)
        {
            return new Vector4(point.x, point.y, point.z,1);
        }
        public static Vector4 NormToVector4(Ponto3D point)
        {
            return new Vector4(point.x, point.y, point.z, 0);
        }

        public static Vector4 toVector4(Ponto2D point)
        {
            return new Vector4(point.x, point.y, 0, 0);
        }

        public static Quaternion toQuaternion(Ponto4D point)
        {
            return new Quaternion(point.x, point.y, point.z, point.w);
        }

        public static Vector2 toVector2(Ponto2D point)
        {
            return new Vector2(point.x, point.y);
        }

        public static Matrix CreateTransformation(Transformation Transformation)
        {
            Vector3 translation = ImporterHelper.toVector3(Transformation.translation);
            Vector3 scale = ImporterHelper.toVector3(Transformation.Scale);
            Matrix rotation = Matrix.CreateFromQuaternion(ImporterHelper.toQuaternion(Transformation.rotationQuaternion));
            return Matrix.CreateTranslation(translation) * rotation * Matrix.CreateScale(scale);
        }

    }
}
